﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rhino.Mocks.Constraints;

namespace test.XcoAppSpaces.Core.Communication.Helpers
{
	class StoreConstraint<T> : AbstractConstraint
	{
		public T Data { get; private set; }

		public override bool Eval(object obj)
		{
			//evaluation only checks type and then stores the data
			if (!(obj is T))
			{
				Data = default(T);
				return false;
			}
			Data = (T)obj;
			return true;
		}

		public override string Message
		{
			get { return "Parameter should be of type " + typeof(T); }
		}
	}
}
